package com.aloda.orangebank.mapper;

import com.aloda.orangebank.pojo.CardApplication;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CardMapper {
    @Select("select count(*) from orangebank.card where owner_username=#{username}")
    int getUserCardNumByUn(String username);

    @Insert("insert into orangebank.card_apply(username, name, phone, mail, card_color, apply_time) " +
            "VALUE(#{username},#{name},#{phone},#{mail},#{cardColor},#{applyTime}) ")
    void addCardLog(CardApplication cardApplication);

    @Select("select count(*) from orangebank.card_apply where username=#{username}")
    int getLogNumByUn(String username);
}
